Part of the Regex Documentation website.
Anchors

Anchors ensure that a match is only permitted at a specific point in the target string.

Since anchors use a backslash - the backslash must be escaped (by the standard backslash) to enable Frontier to pass the backslash to the regex engine.

The following anchors are supported in the regex extension.

\A matches the empty string at the beginning of the target string - anchoring the pattern to the beginning of the string.

Examples
regex.easySearch ("\\AThis", "This old man")
   » true

regex.easySearch ("\\A old man", "This old man")
   » false

 
\Z matches the empty string at the end of the target string - anchoring the pattern to the end of the string.

Examples
regex.easySearch ("man\\Z", "This old man")
   » true

regex.easySearch ("This\\Z", "This old man")
   » false

 
^ matches the empty string at the beginning of the string or after a newline character - anchoring the pattern to the beginning of a line.

Examples
regex.easySearch ("^old", "This\rold man")
   » true - matching "old"

 
$ matches the empty string at the end of the string or before a newline character - anchoring the pattern to the end of a line.

Example
regex.easySearch ("old$", "This\rold\rman", @temp.matchInfo)
   » true - matching "old"

 
\< matches the empty string at the beginning of a word - anchoring the pattern to the start of a word.

Example
regex.easySearch ("\\<rat", "The brat was not a rat!", @temp.matchInfo)
   » true

 
\> matches the empty string at the end of a word - anchoring the pattern to the end of a word.

Example
regex.easySearch ("rat\\>", "Rattle, rattle went the rat!", @temp.matchInfo)
   » true

 
\b matches the empty string at the beginning or end of a word - anchoring the pattern to any word boundary.

Example
regex.easySearch ("\\brat\\b", "Rattle-de-dum went the rat", @temp.matchInfo)
   » true - matching the word "rat"

 
\B matches the empty string within a word - anchoring the pattern to any position that's not word boundary.

Example
regex.easySearch ("rat\\B", "rat's like rattles!", @temp.matchInfo)
   » true

regex.easySearch ("\\Brat", "you dirty, dirty rat")
   » false


This page was last updated at Sun, 08 Nov 1998 17:52:45 GMT.
Please send all questions and comments to regex@lists.scriptmeridian.org.
Check our website for updates to the docs.